package cc.yugu.yhdw.webserver.service.hdw;

import cc.yugu.yhdw.common.constant.CacheKey;
import com.whalin.MemCached.MemCachedClient;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
 * 充电柜属性切面类
 * 
 * @Date:Created in 2018/7/6 15:12
 * @Author:
 * @Modified By: zjn 2018/7/6 15:12
 */ 
@Component
@Aspect
public class CabinetPropertyServiceAspect {

    @Autowired
    MemCachedClient memCachedClient;

    @Pointcut("execution(* cc.yugu.yhdw.webserver.service.hdw.CabinetPropertyService.insert(..))")
    private void insert() {}
    /**
    * 插入
    * 
    * @Param: [joinPoint]
    * @Return: java.lang.Object
    * @Author By: zjn 2018/7/6  15:18
    */ 
    @Around("insert()")
    public Object insert(ProceedingJoinPoint joinPoint) throws Throwable {
        String id = (String) joinPoint.getArgs()[0];
        memCachedClient.delete(CacheKey.key(CacheKey.K_ID_V_CABINET_PROPERTY_LIST, id));
        return joinPoint.proceed();
    }
}
